#pragma once
#include "sqlite3.h"
#include <string>
#include <vector>
using std::wstring;
using std::vector;
namespace grid{
	class SqlResult
	{
	public:
		int getRowCount();
		int setRow(int n);
		int getColumCount();
		wstring getValue(int Colum);
		int nextRow();
	private:
		vector< vector <wstring> > m_result;
		int m_row;
		int m_col;
		friend class DataBaseWrapper;
	};
	class DataBaseWrapper
	{
	public:
		DataBaseWrapper(void);
		int openDatabase(const wstring &dbname);
		int exec(const wstring &statment, SqlResult &result, wstring &errmsg);
		int closeDatabase();
	public:
		~DataBaseWrapper(void);
	protected:
		DataBaseWrapper(const DataBaseWrapper &);
		DataBaseWrapper & operator=(const DataBaseWrapper &);
		sqlite3 *m_db;
	};
}